<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<form method="post" action="${pageContext.request.contextPath}/help/treeManager/${vo.action }.action">
<script type="text/javascript">
function addToolBar() {
	$("#toptoolbar").ligerToolBar({
		items : [ {
			text : '增加子节点',
			img : "${pageContext.request.contextPath}/images/icons/toolbar/add.png",
			click : function(item) {
				location.href = '${pageContext.request.contextPath}/help/treeManager/toAddMenu.action?vo.mid=${vo.mid}&vo.sysType=${vo.sysType}&vo.disabled=false'; 
				
			}
	
		},
		<c:if test="${not empty vo.sysType && vo.sysType ne vo.mid }">
		{
			line : true
		}, {
			text : '修改',
			img : "${pageContext.request.contextPath}/images/icons/toolbar/page_edit.gif",
			click :  function(item) {
				$(":input").each(function(a,b){
					$(b).attr("disabled",false);
					$("#actionTr").show();
					treeDescEditor.readonly(false);
				});
				
			}
			
		}, 
		/**{
			line : true
		}, {
			text : '删除',
			img : "${pageContext.request.contextPath}/images/icons/toolbar/page_delete.gif",
			click :  function(item) {
				
			}
		}, **/
		</c:if>
		{
			line : true
		} ]
	});
}
function itemclick(){
	
}
$(function (){
	//addToolBar();
	//initForm();
});


var treeDescEditor ;
KindEditor.ready(function(K) {
	treeDescEditor = K.create('textarea[name="vo.entity.description"]', {
		cssPath : '${pageContext.request.contextPath}/js/kindeditor/plugins/code/prettify.css',
		uploadJson : '${pageContext.request.contextPath}/kindEditor/uploadImg.action',
		allowFileManager : true,
		readonlyMode : ${vo.disabled},
		//autoHeightMode : true,
		resizeType : 0,
		items : [
				 'bold', 'italic', 'underline',
				'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright',
				'insertunorderedlist', '|', 'emoticons']
		,
		afterCreate : function() {
			//this.loadPlugin('autoheight');
			var self = this;
		},
		
	});
});
//${vo.disabled?'treeDescEditor.readonly();':'treeDescEditor.readonly(false);'  }

</script>
	<input type="hidden" name="vo.entity.pid" id="pid"
		value="${vo.node.pid }">
		<input type="hidden" name="vo.sysType" id="sysType"
		value="${vo.sysType }">
	<div id="topmenu" class="l-topmenu"></div>
	<div class="l-topmenu-index">
		<div id="toptoolbar"></div>
	</div>
	<div id="main-content"
		style="width: 99.2%; margin: 0 auto; margin-top: 4px;">

		<table>
			<tr>
				<td align="right" class="l-table-edit-td">名称:</td>
				<td align="left" class="l-table-edit-td"><input
					name="vo.entity.name" ${vo.disabled?'disabled':''} value="${vo.node.text }" 
					type="text" id="name" ltype="text"
					validate="{required:true,minlength:3,maxlength:10}" /></td>
				<td align="left"></td>
			</tr>
			<tr>
				<td align="right" class="l-table-edit-td">代码:</td>
				<td align="left" class="l-table-edit-td"><input  value="${vo.node.id }"
					name="vo.entity.code" ${vo.disabled?'disabled':''} type="text" id="txtName"
					ltype="text" validate="{required:true,minlength:3,maxlength:10}" />
				</td>
				<td align="left"></td>
			</tr>


			<tr style="display:${(not empty vo.sysType && vo.sysType ne vo.mid)||!disabled?'':'none'}" >
				<td align="right" class="l-table-edit-td">功能描述:</td>
				<td align="left" class="l-table-edit-td"><textarea  value="${vo.node.text }"
						name="vo.entity.description" id="description" cols="100" rows="4"
						class="l-textarea" style="width: 400px">${vo.entity.description }</textarea>
				</td>
				<td align="left"></td>
			</tr>
			<tr>
					<td align="right" class="l-table-edit-td">排序：</td>
					<td align="left" class="l-table-edit-td"></td>
					<td align="left"></td>
				</tr>
				<c:if test="${!vo.disabled }">
				<tr>
					<td align="right" class="l-table-edit-td">${node.text }</td>
					<td align="left" class="l-table-edit-td"> 
					<input name="vo.entity.orderId"
						${vo.disabled?'disabled':''} type="text" id="txtName" ltype="text"
						value="${node.orderId }"
						validate="{required:true,minlength:1,maxlength:10,type:int}" /></td>
					<td align="left"></td>
				</tr>
				</c:if>
			<c:if test="${not empty vo.parentNode }">
			<c:forEach var="node" items="${vo.parentNode.children }" varStatus="status">
			<c:if test="${node.id ne vo.mid }">
				<tr>
					<td align="right" class="l-table-edit-td">${node.text }</td>
					<td align="left" class="l-table-edit-td"><input
						name="vo.parentNode.children[${status.index }].id" type="hidden"
						value="${node.id }" /> <input
						name="vo.parentNode.children[${status.index }].orderId"
						${vo.disabled?'disabled':''} type="text" id="txtName" ltype="text"
						value="${node.orderId }"
						validate="{required:true,minlength:1,maxlength:10,type:int}" /></td>
					<td align="left"></td>
				</tr>
				</c:if>
				<c:if test="${node.id eq vo.mid }">
				<tr>
					<td align="right" class="l-table-edit-td">${node.text }</td>
					<td align="left" class="l-table-edit-td"> 
					<input name="vo.entity.orderId"
						${vo.disabled?'disabled':''} type="text" id="txtName" ltype="text"
						value="${node.orderId }"
						validate="{required:true,minlength:1,maxlength:10,type:int}" /></td>
					<td align="left"></td>
				</tr>
				</c:if>
			</c:forEach>
			</c:if>
			<tr style="display: ${vo.disabled?'none':''}" id="actionTr">
				<td align="right" class="l-table-edit-td">
					<input type="submit" value="提交" id="Button1"
			class="l-button l-button-submit" /> 
				</td>
				<td align="left" class="l-table-edit-td">
				<input type="reset" value="重置"
			class="l-button l-button-test" />
				</td>
				<td align="left"></td>
			</tr>
		</table>

	</div>
</form>
